#include <iostream>
#include <vector>
using namespace std;

void test01()
{
	vector<int> v1;
	vector<int> v2(10, 1);
	vector<int> v3(v2);
	v1 = v3;

	for (size_t i = 0; i < v1.size(); i++)
	{
		cout << v1[i] << " ";
	}
	cout << endl;

	vector<int>::iterator it = v2.begin();
	while (it != v2.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;


	for (auto e : v3)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test02()
{
	vector<int> v1(10, 1);
	cout << v1.size() << " " << v1.capacity() << endl;
	v1.resize(20,2);
	cout << v1.size() << " " << v1.capacity() << endl;
	v1.resize(5);
	cout << v1.size() << " " << v1.capacity() << endl;

	v1.push_back(6);
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;

	v1.insert(v1.begin() + 3, 8);
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
	vector<int> v2(5, 0);
	for (size_t i = 0; i < v2.size(); i++)
	{
		cin >> v2[i];
	}
	for (auto e : v2)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test03()
{
	vector<string> v1;
	string s1 = "hello world";
	v1.push_back(s1);
	for (const auto& e : v1)
	{
		cout << e;
	}
	cout << endl;
	vector<string> v2;
	v2.push_back("hello world!");
	for (const auto& e : v2)
	{
		cout << e;
	}
	cout << endl;
	
}

void test04()
{
	vector<int> v1(5, 1);
	vector<vector<int>> v2(6, v1);
	for (size_t i = 0; i < v2.size(); i++)
	{
		for (size_t j = 0; j < v2[i].size(); j++)
		{
			cout << v2[i][j] << " ";
		}
		cout << endl;

	}
	cout << endl;
}

void test05()
{
	vector<int>array;

	array.push_back(100);

	array.push_back(300);

	array.push_back(300);

	array.push_back(300);

	array.push_back(300);

	array.push_back(500);

	vector<int>::iterator itor;

	for (itor = array.begin(); itor != array.end(); itor++)

	{

		if (*itor == 300)

		{

			itor = array.erase(itor);

		}

	}

	for (itor = array.begin(); itor != array.end(); itor++)

	{

		cout << *itor << " ";

	}
}


int main()
{
	//test01();
	//test02();
	//test03();
	//test04();
	//test05();

	return 0;
}